import { postNoHeader, getNoHeader } from '@/utils/request'

/**
 *  第三方接口
 *      - 知识库
 **/
var ThirdApi = {
  /**
   * 知识搜索接口
   * @param
   *    - type queryParam 知识搜素接口
   *
   */
  kbpAPI: (param) => {
    return postNoHeader(window.CONFIG.kbpAPI.url + '/open/api/knowledge/search', param, '知识库-知识搜素', 'faq_directory.knowledge.search')
  },
  /**
   * 知识详情-同步调用
   * @param
   *   - problemId 问题ID
   *   - successHandler 成功回调 201807021107092153
   **/
  kbpDetailAPI: (param) => {
    return getNoHeader(window.CONFIG.kbpAPI.url + '/open/api/knowledge/detail/' + param, '知识库-知识详情-同步调用', 'faq_directory.knowledge.detail')
  },

  /**
   * 常见问题查询树
   * @param
   *   - type 座席常见问题 -- AGENT_FAQ
   *   - type 座席组件常见问题 -- AGENT_COMPONENT_FAQ
   **/
  kbpFaqAPI: () => {
    var type = 'AGENT_FAQ'
    var series = 'BOCHW'
    return getNoHeader(window.CONFIG.kbpAPI.url + '/open/api/faq_directory/tree?series=' + series + '&type=' + type, '知识库-常见问题查询树', 'faq_directory.tree')
  },
  /**
   * 常见问题答案查询
   * @param
   *   - type 座席常见问题 -- AGENT_FAQ
   *   - type 座席组件常见问题 -- AGENT_COMPONENT_FAQ
   **/
  kbpAnsAPI: (id, name, pageNum, pageSize, type) => {
    // var type = 'AGENT_FAQ'
    var series = 'BOCHW'
    return getNoHeader(window.CONFIG.kbpAPI.url + '/open/api/faq_directory/query_knowledge_list?id=' + id + '&name=' + name + '&type=' + type + '&series=' + series + '&pageNum=' + pageNum + '&pageSize=' + pageSize, '知识库-常见问题答案查询', 'faq_directory.query_knowledge_list')
  },
  /**
   * 根据知识id查询手动关联知识列表和自动关联知识列表接口
   * @param
   *    - knowledgeId   知识Id
   *    - userId        用户Id
   *    - series        系列 BOC
   *    - srcSystem     来源系统 MCSR
   */
  kbpQueryRelatedKnowledgeAPI: (param) => {
    return postNoHeader(window.CONFIG.kbpAPI.url + '/open/api/knowledge/query/related-knowledge', param, '知识库-根据知识id查询手动关联知识列表和自动关联知识列表接口', 'faq_directory.related-knowledge')
  }
}

export default ThirdApi
